package com.ljf.spring;

import com.ljf.framework.Async.AsyncService;
import com.ljf.framework.LjfManager;
import com.ljf.framework.cache.LjfCacheService;
import com.ljf.framework.context.LjfContext;
import com.ljf.framework.context.second.LjfSecondContextCreator;
import com.ljf.framework.job.LjfJobService;
import com.ljf.framework.password.PasswordEncoderService;
import com.ljf.framework.security.LjfSecurityService;
import com.ljf.framework.security.token.LjfTokenConfig;
import com.ljf.framework.security.token.LjfTokenService;
import com.ljf.framework.shutdown.LjfShutdownManager;
import com.ljf.framework.util.json.LjfJsonService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 说明：注入ljf所需要的Bean
 *
 * 注入spring上下文bean
 *
 * @Auther: lijinfeng
 * @Date: 2024/4/22
 */
public class LjfBeanInject {

    /**
     * 注入安全服务
     */
    @Autowired(required = false)
    public void setLjfSecurityService(LjfSecurityService ljfSecurityService) {
        LjfManager.setLjfSecurityService(ljfSecurityService);
    }

    /**
     * 注入缓存服务
     */
    @Autowired(required = false)
    public void setLjfCacheService(LjfCacheService ljfCacheService) {
        LjfManager.setLjfCacheService(ljfCacheService);
    }

    /**
     * 注入密码服务
     */
    @Autowired(required = false)
    public void setPasswordEncoderService(PasswordEncoderService passwordEncoderService) {
        LjfManager.setPasswordEncoderService(passwordEncoderService);
    }

    /**
     * 注入上下文Bean
     */
    @Autowired(required = false)
    public void setLjfContext(LjfContext ljfContext) {
        LjfManager.setLjfContext(ljfContext);
    }

    /**
     * 注入二级上下文Bean
     */
    @Autowired(required = false)
    public void setLjfSecondContext(LjfSecondContextCreator ljfSecondContextCreator) {
        LjfManager.setLjfSecondContext(ljfSecondContextCreator.create());
    }

    /**
     * 注入token配置
     */
    @Autowired(required = false)
    public void setLjfTokenConfig(LjfTokenConfig ljfTokenConfig) {
        LjfManager.setLjfTokenConfig(ljfTokenConfig);
    }

    /**
     * 注入token服务
     */
    @Autowired(required = false)
    public void setLjfTokenService(LjfTokenService ljfTokenService) {
        LjfManager.setLjfTokenService(ljfTokenService);
    }

    /**
     * 注入json服务
     */
    @Autowired(required = false)
    public void setLjfJsonService(LjfJsonService ljfJsonService) {
        LjfManager.setLjfJsonService(ljfJsonService);
    }

    /**
     * 注入异步服务
     */
    @Autowired(required = false)
    public void setAsyncService(AsyncService asyncService) {
        LjfManager.setAsyncService(asyncService);
    }

    /**
     * 注入关机处理
     */
    @Autowired(required = false)
    public void setShutDown() {
        LjfShutdownManager.setShutdown();
    }

    /**
     * 注入关机处理
     */
    @Autowired(required = false)
    public void setLjfJobService(LjfJobService ljfJobService) {
        LjfManager.setLjfJobService(ljfJobService);
    }
}
